package au.edu.qut.bpm.genbinder.models;

import java.util.Set;

import org.deckfour.xes.model.XAttributeMap;
import org.deckfour.xes.model.buffered.XAttributeMapBufferedImpl;

public class Activity {
	protected String id;
	protected String name;

	private Case oCase;
	private Task task;
	private long startTime;
	private long duration;
	private Set<Resource> resource;

	private XAttributeMap attributes;

	public Activity(String id, String name, Case oCase, Task task, long startTime, long duration, Set<Resource> resource) {
		this(id, name, oCase, task, startTime, duration, resource, new XAttributeMapBufferedImpl());
	}

	public Activity(String id, String name, Case oCase, Task task, long startTime, long duration, Set<Resource> resource, XAttributeMap attributes) {
		this.id = id;
		this.name = name;
		this.oCase = oCase;
		this.task = task;
		this.startTime = startTime;
		this.duration = duration;
		this.resource = resource;
		this.attributes = attributes;
	}

	public String getId() {
		return id;
	}
	
	public String getName () {
		return name;
	}
	
	public void setName (String name) {
		this.name = name;
	}
	
	public void setResource (Set<Resource> resource) {
		this.resource = resource;
	}
	
	public void setStartTime (long startTime) {
		this.startTime = startTime;
	}
	
	public void setDuration (long duration) {
		this.duration = duration;
	}

	public XAttributeMap getAttributes() {
		return attributes;
	}

	public Case getCase() {
		return oCase;
	}

	public Task getTask() {
		return task;
	}
	
	public long getStartTime() {
		return startTime;
	}

	public long getDuration() {
		return duration;
	}
	
	public Set<Resource> getResource() {
		return resource;
	}

	@Override
	public String toString() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Activity other = (Activity) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

}
